<?php

use think\migration\Migrator;
use think\migration\db\Column;

class CreateTableTemplateMessage extends Migrator
{
    /**
     * Change Method.
     *
     * Write your reversible migrations using this method.
     *
     * More information on writing migrations is available here:
     * http://docs.phinx.org/en/latest/migrations.html#the-abstractmigration-class
     *
     * The following commands can be used in this method and Phinx will
     * automatically reverse them when rolling back:
     *
     *    createTable
     *    renameTable
     *    addColumn
     *    renameColumn
     *    addIndex
     *    addForeignKey
     *
     * Remember to call "create()" or "update()" and NOT "save()" when working
     * with the Table class.
     */
    public function up()
    {
        $this->execute("CREATE TABLE `f_template_message` (
            `id` int(11) NOT NULL AUTO_INCREMENT,
            `type` varchar(45) DEFAULT NULL COMMENT '类型',
            `touser` varchar(45) DEFAULT NULL COMMENT '发送opened',
            `template_id` varchar(64) DEFAULT NULL COMMENT '模版id',
            `url` varchar(145) DEFAULT NULL COMMENT '链接地址',
            `first` json DEFAULT NULL COMMENT '模版参数',
            `keyword1` json DEFAULT NULL COMMENT '参数',
            `keyword2` json DEFAULT NULL COMMENT '模版参数',
            `keyword3` json DEFAULT NULL COMMENT '模版参数',
            `remark` json DEFAULT NULL COMMENT '模版参数',
            `status` varchar(45) DEFAULT NULL COMMENT '状态',
            `create_time` int(11) DEFAULT NULL COMMENT '创建时间',
            `creator` int(11) DEFAULT NULL COMMENT '创建人',
            `finish_time` int(11) DEFAULT NULL COMMENT '完成时间',
            PRIMARY KEY (`id`)
          ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='模版消息';");
    }
    public function down() {
        $this->execute("drop table `f_template_message`;");
    }
}
